﻿@using Smartstore.Web.Models.Catalog

@model ProductDetailsModel

@{
    // INFO: in case of a collapsible accordion, the parent card item is the update container.
    var skipUpdateUrl = (ViewData["SkipUpdateUrl"] as bool?) ?? false;
    var gallery = Model.MediaGalleryModel;
    var img = gallery.Files?.FirstOrDefault();
}

<article class="pd-variant row@(skipUpdateUrl ? string.Empty : " update-container")" 
         attr-data-url='(!skipUpdateUrl, Model.UpdateUrl)'
         itemscope 
         itemtype="http://schema.org/Product">
    <div class="col-4 col-sm-6 col-lg-3">
        <div class="pd-variant-picture img-center-container">
            @if (img != null)
            {
                <img class="pd-dyn-thumb" src="@img.GetUrl(gallery.ImageSize)" alt="@(img.Alt.NullEmpty() ?? img.TitleAttribute)" title="@img.TitleAttribute" />
            }
            else if (gallery.FallbackUrl.HasValue())
            {
                <img class="pd-dyn-thumb" src="@gallery.FallbackUrl" alt="@gallery.DefaultAlt" />
            }
        </div>
    </div>
    <div class="col-8 col-sm-6 col-lg-4">
        @* Title/Brand/ReviewSummary *@
        <partial name="Product.Info" model="Model" />

        @* Product attributes (SKU, EAN, Weight etc.) *@
        <div class="pd-attrs-container" data-partial="Attrs">
            <partial name="Product.Attrs" model="Model" />
        </div>
    </div>
    <div class="col col-lg-5 d-flex flex-column">
        @* Offer box *@
        <partial name="Product.Offer" model="Model" />
    </div>
</article>